package com.jfok.server.controller.login;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jfok.server.common.ActionResult;
import com.jfok.server.common.ILoginService;
import com.jfok.server.login.LoginService;
import com.jfok.server.service.SystemGlobalInfoService;

@Controller
@RequestMapping("/login")
public class LoginController implements ILoginService {

	Log log = LogFactory.getLog(LoginController.class);

	@Resource
	private LoginService loginService;

	@Override
	@RequestMapping("/login.do")
	public @ResponseBody
	ActionResult login(String loginname, String base64password, String identifyingCode,
			HttpServletRequest request) {
		return loginService.login(loginname, base64password, identifyingCode, request);
	}

	@Override
	@RequestMapping("/logout.do")
	public @ResponseBody
	void logout(HttpServletRequest request, HttpServletResponse response) {
		loginService.logout(request, response);
	}

	@Override
	@RequestMapping(value = "/forgetPassword.do", produces = "text/plain;charset=UTF-8")
	public @ResponseBody
	String forgetPassword() {
		return SystemGlobalInfoService.getSystemsetAddition().getTf_userforgetPassword();
	}

}
